package com.aizhixin.lab.statistics.util;

import com.aizhixin.lab.common.core.LabReportCore;
import io.swagger.models.auth.In;

public class ReportUtils {
    public static Integer getScore(String score){
        if (score==null || "init".equals(score)|| LabReportCore.REPORT_STATUS_INIT.equals(score)||LabReportCore.REPORT_STATUS_UNCOMMIT.equals(score)||LabReportCore.REPORT_STATUS_UNCHECKED.equals(score)){
            return 0;
        }
        switch (score){
            case "A+":
                return 90;
            case "A":
                return 80;
            case "B+":
                return 70;
            case "B":
                return 60;
            case "C+":
                return 50;
            case "C":
                return 40;
            case "D+":
                return 30;
            case "D":
                return 20;
            case "F+":
                return 10;
            case "F":
                return 0;
            default:
                return Double.valueOf(score).intValue();
        }
    }
    public static String getLevel(Integer grade){
        if (grade>90){
            return "A+";
        }else if(grade>85){
            return "A";
        }else if(grade>80){
            return "B+";
        }else if(grade>75){
            return "B";
        }else if(grade>70){
            return "C+";
        }else if(grade>65){
            return "C";
        }else if(grade>60){
            return "D+";
        }else if(grade>50){
            return "D";
        }else if(grade>40){
            return "F+";
        }else {
            return "F";
        }
    }
}
